import { ref, computed } from 'vue'
import { defineStore } from 'pinia'
import { getApiList } from '../server'
import type { RootObject, Children, ChinaAdd, ChinaTotal,StatisGradeCityDetail, } from './type'

export const useStore = defineStore({
  id: 'listStore',
  state: () => ({
    list: <RootObject>{},
    item: <Children[]>[],
    ChinaAdd: <ChinaAdd>{},  //新增
    ChinaTotal: <ChinaTotal>{}, //现有
    CityDetail:<StatisGradeCityDetail[]>[]
  }),
  actions: {
    async getList() {
      const result = await getApiList()
      this.list = result
      this.ChinaAdd = this.list.diseaseh5Shelf.chinaAdd
      this.ChinaTotal = this.list.diseaseh5Shelf.chinaTotal
      this.CityDetail = this.list.statisGradeCityDetail.slice(0,6)
      
    }
  }
})
